package com.offer;

import java.util.HashSet;

/**
 * @Author: huangzhigao
 * @Date: 2023/3/4 15:34
 */
public class offer03 {
    public int findRepeatNumber(int[] nums) {
        HashSet<Integer> set = new HashSet<>();
        for (int num : nums) {
            if (set.contains(num)) {
                return num;
            }
            set.add(num);
        }
        return -1;
    }
}
